<template>
    <div>
        <h1>用户列表</h1>
        <ul >
            <li v-for="user in users" :key="user.id">{{ user.name }},{{ user.age }}</li>
        </ul>
    </div>
</template>
<script setup>

import axios from 'axios';
import { onMounted, ref } from 'vue';
import { getUser } from '@/api/index.js';

const users=ref([])

onMounted(async()=>{
    try{
        const responce= await getUser()
        console.log(responce);
        
        users.value=responce.data.data

    }catch(error){
        console.error('获取用户列表失败',error);
        
    }
})


</script>